/*
 * @Author: weipwang 
 * @Date: 2018-03-13 17:42:00 
 * @Last Modified by: weipwang
 * @Last Modified time: 2018-03-14 15:07:20
 */


import $ from 'jquery'

class Interface{
    /**
     * 
     * 
     * 获取遗漏号码
     * @param {any} issue 
     * @returns 
     * @memberof Interface
     */
    getOmit(issue){
        let _this = this
        return new Promise((resolve, reject)=>{
            $.ajax({
                url: '/get/omit',
                data: {
                    issue: issue
                },
                dataType: 'json',
                success: function(res){
                    _this.setOmit(res.data)
                    resolve.call(_this, res)
                },
                error: function (err) {
                    reject.call(err)
                }          
            })
        })
    }
    /**
     * 获取开奖号码
     * 
     * @param {any} issue 
     * @memberof Interface
     */
    getOpenCode(issue){
        let _this = this
        return new Promise((resolve, reject)=>{
            $.ajax({
                url: '/get/opencode',
                data: {
                    issue: issue
                },
                dataType: 'json',
                success: function(res) {
                    _this.setOpenCode(res.data)
                    resolve.call(_this, res)
                },
                error: function (err) {
                    reject.call(err)
                }
            })
        })
    }
    /**
     * 获取当前状态
     * 
     * @param {any} issue 
     * @memberof Interface
     */
    getState(issue){
        let _this = this
        return new Promise((resolve, reject)=>{
            $.ajax({
                url:'/get/state',
                data: {
                    issue: issue
                },
                dataType: 'json',
                success: function(res) {
                    resolve.call(_this,res)
                },
                error: function (err) {
                    reject.call(err)
                }
            })
        })
    }
    
}

export default Interface 